import BaseAnimationCanvas from "./BaseAnimationCanvas";
import BaseLifeCyclePainting from "../Painting/BaseLifeCyclePainting";
import Base2DPainter from "../Painter/Base2DPainter";

export default class LifeCycleCanvas extends BaseAnimationCanvas {

    constructor({id, zIndex = 0, painterType = Base2DPainter}) {
        super({id, zIndex, painterType});
    }

    drawFrame() {
        this.paintings = this.paintings.filter(painting => {
            if (!(painting instanceof BaseLifeCyclePainting)) {
                return true;
            }
            return painting['getStatus']() !== BaseLifeCyclePainting.DESTROYED;
        });
        super.drawFrame();
    }
}